<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui" xml:lang="en" lang="en">
    <head>
        <title>My Facelets Page</title>
        <meta http-equiv="keywords" content="enter,your,keywords,here" />
        <meta http-equiv="description"
              content="A short description of this page." />
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

        <!--<link rel="stylesheet" type="text/css" href="styles.css">-->
    </head>
    <body>
        <ui:composition template="BackGeneral.xhtml">
            <ui:define name="content">
                <h:form id="form11"><div>
                        <h:outputText id="outputText1" styleClass="tit"
                                      value="－－－新增版面－－－" rendered="#{!aAZone.flag}"/>
                        <h:outputText id="outputText2" styleClass="tit"
                                      value="－－－修改版面－－－" rendered="#{aAZone.flag}"/>
                        <p:separator/>
                        <h:panelGrid columns="2">
                            <h:outputText value="版面名称：" />
                            <h:inputText value="#{aAZone.zone.name}" style="width:400px" />

                            <h:outputText value="版面描述：" />
                            <h:inputTextarea value="#{aAZone.zone.description}"  style="width:400px;height:100px;" />

                            <h:outputText value="版面位次：" />
                            <h:inputText value="#{aAZone.zone.orderIndex}" style="width:40px" />
                            
                            <h:outputText value="发贴权限：" />
                            <h:panelGroup>
                                <h:outputText value="只允许版主发贴？" />
                                <h:selectBooleanCheckbox value="#{aAZone.zone.ifOnlyMag}"/>
                            </h:panelGroup>
                            <h:outputText value="版主："  />
                            <p:dataTable value="#{aAZone.zone.managers}" var="mag" id="mags">
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="用户名"/>
                                    </f:facet>
                                    <h:outputText value="#{mag.username}"/>
                                </p:column>
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="积分"/>
                                    </f:facet>
                                    <h:outputText value="#{mag.score}"/>
                                </p:column>
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="删除"/>
                                    </f:facet>
                                    <p:commandLink value="删除" action="#{aAZone.deleteMag(mag.id)}" update=":form11:mags">
                                    </p:commandLink>
                                </p:column>
                            </p:dataTable>
                        </h:panelGrid>
                        <p:panel header="新增版主--搜索">
                            <h:panelGrid columns="3">
                                <h:outputLabel value="用户名："/>
                                <p:inputText value="#{aAZone.str}"/>
                                <p:commandButton value="查找" action="#{aAZone.searchUser}" update=":form11:users"/>
                            </h:panelGrid>
                        </p:panel>
                        <p:dataTable value="#{aAZone.newUsers}" var="user" id="users">
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="用户名"/>
                                </f:facet>
                                <h:outputText value="#{user.username}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="积分"/>
                                </f:facet>
                                <h:outputText value="#{user.score}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="添加"/>
                                </f:facet>
                                <p:commandLink value="添加" action="#{aAZone.addMag(user.id)}" update=":form11:mags :form11:users">
                                </p:commandLink>
                            </p:column>
                        </p:dataTable>

                        <p:commandButton action="#{aAZone.done}" value="提交" />
                        <p:outputPanel autoUpdate="true">
                            <h:messages styleClass="msg"></h:messages>
                        </p:outputPanel>

                    </div></h:form>
            </ui:define>
        </ui:composition>
    </body>
</html>
